<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>回顾事件指令</title>
</head>

<body>
    <div id="app">
        <button onclick="clcikMe1()">单件我1</button>
        <button id="btn2">单件我2</button>
        <button id="btn3">单件我3</button>
    </div>
</body>

</html>
<script>
    function $(id) {
        return document.getElementById(id);
    };

    function clcikMe1() {
        window.alert("单击我1");
    };
    //当加载页面的时候调用此方法
    window.onload = function () {
        
        $("btn2").addEventListener('click', function () {
            window.alert("单击我2");
        });

        $("btn3").onclick = function () {
            window.alert("单击我3");
        };

    };


</script>